﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using BuckleyChurch.Business;
using System.Configuration;

namespace ChurchData
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string currentEnvironemnt = new AppSettingsReader().GetValue("CurrentEnvironment", typeof(String)).ToString();
            string conKey = currentEnvironemnt + "ConnectionString";

            GlobalBusiness.ConnectionString = new AppSettingsReader().GetValue(conKey, typeof(String)).ToString();
            GlobalBusiness.CurrentEnvironment = currentEnvironemnt;

            LoginForm frmLogin = new LoginForm();
            Application.Run(frmLogin);
            if (frmLogin.DialogResult == DialogResult.OK)
                Application.Run(new MainForm());
        }
    }
}
